#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

static int fd;

void init_smoke()
{
    fd = open("/dev/smoke_drv", O_RDWR);
    if(fd < 0)
    {
        perror("open /dev/smoke_drv");
        return ;
    }
}

int read_smoke()
{
    int flag=0;
    if(fd > 0)
    {
        //while(1)
        {
            int ret = read(fd,&flag, sizeof (flag));
            if (ret < 0)
            {
                perror("read /dev/smoke_drv error\n");
                return 0;
            }

            //printf("light flag = %d\n",light_flag);
        }
    }

    return flag;
}
